import { createStore } from "zustand/vanilla";
import { createWithEqualityFn } from "zustand/traditional";

export type CounterState = {
  list: any[];
};

export type CounterActions = {
  // incrementCount: () => void;
};

export type CounterStore = CounterState & CounterActions;

// export const initCounterStore = (): CounterState => {
//   return { count: new Date().getFullYear() };
// };

export const defaultInitState: CounterState = {
  list: [],
};

export const createCounterStore = (
  initState: CounterState = defaultInitState
) => {
  return createWithEqualityFn<CounterStore>()((set) => ({
    ...initState,
    // incrementCount: () => set((state) => ({ count: state.count + 1 })),
  }));
};
